import * as webpack from 'webpack';
import * as merge from 'webpack-merge';
import * as HtmlWebpackPlugin from 'html-webpack-plugin';
import * as path from 'path';
import BaseConfig from '../webpack.config'

const config = merge(BaseConfig, {
    mode: 'development',
    output: {
        publicPath: '/'
    },
    devtool: "source-map",
    devServer: {
        contentBase: './dist',
        port: 8000,
        hot: true,
        proxy: {
            '/': {
                target: 'http://45.40.244.50:5000',
                changeOrigin: true,
                pathRewrite: {
                    '^/proxy': ''
                }
            }
        }
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: path.join(__dirname, '../public/index.html'),
            filename: "index.html",
            favicon: path.join(__dirname,'../src/assets/favicon.ico'),
            hash: true,
            path: "http://localhost:8001/"
        }),
        new webpack.HotModuleReplacementPlugin()
    ]
} as webpack.Configuration)

export default config;